<template>
  <div class="address">
    <van-nav-bar title="我的地址" left-arrow @click-left="$router.go(-1)" />
    <div class="form">
      <div class="item">
        <span>收货人：</span>
        <input type="text" placeholder="请输入收货人名称" v-model="username">
      </div>
      <div class="item">
        <span>联系电话：</span>
        <input type="text" placeholder="请输入收货人联系电话" v-model="mobile">
      </div>
      <div class="change" @click="selectAddress">
        <span>请选择省市区</span>
        <span class="info"></span>
        <van-icon name="arrow" />
      </div>
      <div>
        <textarea v-model="area" class="area" placeholder="请输入详细地址" rows="10" cols="20"></textarea>
      </div>
    </div>

    <div class="btn">
      <button>添加</button>
    </div>

    <van-area title="选择地址" :area-list="areaList" value="110101" />
  </div>
</template>

<script>
import { areaList } from '@vant/area-data'

export default {
  name: 'AddressPage',
  data () {
    return {
      username: '',
      mobile: '',
      area: '',
      areaList: areaList
    }
  },
  methods: {
    selectAddress () {
    }
  }
}
</script>

<style lang="less" scoped>
.form {
  padding: 10px;
  background-color: #fafafa;
  .item {
    display: flex;
    border-bottom: 1px solid #ccc;
    align-items: center;
    justify-content: flex-start;
    span {
      width: 80px;
      font-size: 16px;
    }
    input {
      flex: 1;
      border: none;
      outline: none;
      height: 50px;
      font-size: 16px;
    }
  }
  .change {
    display: flex;
    align-items: center;
    height: 50px;
    padding: 10px 0;
    font-size: 16px;
    .info {
      flex: 1;
      margin: 10px 0;
      span {
        -webkit-line-clamp: 1;
        text-overflow: ellipsis;
        overflow: hidden;
      }
    }
  }
  .area {
    width: 100%;
    height: 80px;
    border: none;
    margin-top: 10px;
    padding: 10px;
    background-color: white;
  }
}
.btn {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  button {
    display: block;
    width: 80%;
    height: 45px;
    text-align: center;
    font-size: 18px;
    color: white;
    background-color: #fa2209;
    border-radius: 24px;
    border: none;
  }
}
</style>
